import request from '@/router/axios';
import website from '@/config/website';

const serviceName = "/blade-xy-big-screen";
//数采首页 设备
export const equipmentinfoScreenData = () => {
    return request({
      url: '/api'+ serviceName +'/equipmentinfo/screenData',
      method: 'get'
    })
}

// 获取token
export const getScToken = (data) => {
    return request({
        url: `http://${website.getDataLink}/api/auth/login`,
        method: 'post',
        data
    })
}

//根据工作组名称获取工作组设备
export const equipmentinfoList = (workGroup) => {
    return request({
      url: '/api'+ serviceName +'/equipmentinfo/list',
      method: 'get',
      params: {
        workGroup
      }
    })
}

//工作组及设备设置 列表
export const getEquipmentList = () => {
    return request({
      url: '/api'+ serviceName +'/equipmentinfo/getEquipmentList',
      method: 'get'
    })
}

//工作组及设备设置 列表 保存
export const equipmentinfoUpdate = (data) => {
    return request({
      url: '/api'+ serviceName +'/equipmentinfo/update',
      method: 'post',
      data: data
    })
}

//实时数据页面 下拉框
export const getByWorkGroup = () => {
    return request({
      url: '/api'+ serviceName +'/equipmentinfo/getByWorkGroup',
      method: 'get'
    })
}

//实时数据页面 列表
export const getAllData = (name, time1, time2, weldCode) => {
    return request({
      url: '/api'+ serviceName +'/equipmentdata/getAllData',
      method: 'get',
      params: {
        name, time1, time2, weldCode
      }
    })
}

//参数预警 列表
export const equipmentreferenceList = (type) => {
  return request({
    url: '/api'+ serviceName +'/equipmentreference/list',
    method: 'get',
    params: {
      type
    }
  })
}
//参数预警 保存
export const equipmentreferenceUpdate = (data) => {
  return request({
    url: '/api'+ serviceName +'/equipmentreference/update',
    method: 'post',
    data
  })
}

//校正设置 列表
export const equipmentcompareList = (type) => {
  return request({
    url: '/api'+ serviceName +'/equipmentcompare/list',
    method: 'get',
    params: {
      type
    }
  })
}
//校正设置 保存
export const equipmentcompareUpdate = (data) => {
  return request({
    url: '/api'+ serviceName +'/equipmentcompare/update',
    method: 'post',
    data
  })
}

//压机实时状态参数 一次成型时间、二次冲切时间 正/异常
export const assemblyData = (name) => {
  return request({
    url: '/api'+ serviceName +'/equipmentreference/assemblyData',
    method: 'get',
    params: {
      name
    }
  })
}

//一周产量
export const weekproductionList = (weeks,group) => {
  return request({
    url: '/api'+ serviceName +'/weekproduction/list',
    method: 'get',
    params: {
      weeks,group
    }
  })
}

//异常饼图  type 1 饼图 ； 2 列表
export const equipmentExceptionData = (startTime,  endTime, type, equipmentNames) => {
  return request({
    url: '/api'+ serviceName +'/equipmentexception/equipmentExceptionData',
    method: 'get',
    params: {
      startTime,  endTime, type, equipmentNames
    }
  })
}

//焊接机-焊点 列表
export const weldpointList = (equipmentId) => {
  return request({
    url: '/api'+ serviceName +'/weldpoint/list',
    method: 'get',
    params: {
      equipmentId
    }
  })
}
//焊接机-焊点 新增
export const weldpointSave = (data) => {
  return request({
    url: '/api'+ serviceName +'/weldpoint/save',
    method: 'post',
    data
  })
}
//焊接机-焊点 修改
export const weldpointUpdate = (data) => {
  return request({
    url: '/api'+ serviceName +'/weldpoint/update',
    method: 'post',
    data
  })
}
//焊接机-焊点 删除
export const weldpointRemove = (id) => {
  return request({
    url: '/api'+ serviceName +'/weldpoint/remove',
    method: 'post',
    params: {
      id
    }
  })
}

//模具寿命
export const moudleLife = () => {
  return request({
    url: '/api'+ serviceName +'/weekproduction/moudleLife',
    method: 'get'
  })
}

//检具信息 列表
export const mouldinfoPage = () => {
  return request({
    url: '/api'+ serviceName +'/mouldinfo/page',
    method: 'get'
  })
}
export const mouldinfoList = () => {
  return request({
    url: '/api'+ serviceName +'/mouldinfo/list',
    method: 'get'
  })
}
//检具信息 批量保存
export const mouldinfoBatchUpdate = (data) => {
  return request({
    url: '/api'+ serviceName +'/mouldinfo/batchUpdate',
    method: 'post',
    data: data
  })
}
//检具信息 删除
export const mouldinfoRemove = (id) => {
  return request({
    url: '/api'+ serviceName +'/mouldinfo/remove',
    method: 'post',
    params: {
      id
    }
  })
}

//  检具 列表
export const mouldcheckrecordSelectTodayData = (mouldIds, status, type) => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckrecord/selectTodayData',
    method: 'get',
    params: {
      mouldIds, status, type
    }
  })
}

//  检具 历史数据列表
export const mouldcheckrecordSelectHistoryData = (mouldIds, startDate, endDate, status, type) => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckrecord/selectHistoryData',
    method: 'get',
    params: {
      mouldIds, startDate, endDate, status, type
    }
  })
}

//检具信息 删除
export const mouldcheckrecordRemove = (id) => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckrecord/remove',
    method: 'post',
    params: {
      id
    }
  })
}

// 检具检查项维护
export const mouldcheckitemList = () => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckitem/list',
    method: 'get'
  })
}
//检具检查项维护 保存
export const mouldcheckitemSubmit = (data) => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckitem/submit',
    method: 'post',
    data: data
  })
}
//检具信息 删除
export const mouldcheckitemRemove = (ids) => {
  return request({
    url: '/api'+ serviceName +'/mouldcheckitem/remove',
    method: 'post',
    params: {
      ids
    }
  })
}